# Maintainer: Ronald van Haren <ronald.archlinux.org>
# Contributor: bzklrm <bzklrm@gmail.com>
# Additional contributors Senjin, Xavier, dundee

pkgname=glpk
pkgver=4.65
pkgrel=2
pkgdesc="GNU Linear Programming Kit : solve LP, MIP and other problems."
arch=('x86_64')
url="http://www.gnu.org/software/glpk/glpk.html"
license=('GPL')
depends=('gmp')
source=(http://ftp.gnu.org/gnu/glpk/${pkgname}-${pkgver}.tar.gz{,.sig} glpk-remove-warnings.patch)
sha1sums=('d9b607a9cf3a25b754a0cd9a842ea5043f8604db'
          'SKIP'
          '6f4e904c5dc88a8b43391e030496644d77e39163')
validpgpkeys=('A2B56CCB42220C06481335BAD17BF2305981E818') # Andrew Makhorin

prepare() {
  cd $pkgname-$pkgver
  patch -p1 -i ../glpk-remove-warnings.patch # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=891465
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --prefix=/usr --with-gmp
  make
}

package(){
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  install -Dm644 doc/glpk.pdf "${pkgdir}/usr/share/doc/glpk/glpk.pdf"
  install -Dm644 doc/gmpl.pdf "${pkgdir}/usr/share/doc/glpk/gmpl.pdf"
}
